﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;

namespace Boxie
{
    public partial class frmChangelog : Form
    {
        public frmChangelog()
        {
            InitializeComponent();
            if (BoxieRegLib.GetSettingBool("General/WindowTopMost", true))
                this.TopMost = true;
        }

        public void getChanges()
        {
            txtChanges.Text = "Loading Changes...";
            txtChanges.Refresh();
            this.Refresh();

            string result = "";

            try
            {    
                WebRequest wr = WebRequest.Create("http://www.ethryx.net/boxie/changes.txt");
                WebResponse wrs = wr.GetResponse();
                StreamReader sr = new StreamReader(wrs.GetResponseStream());
                result = sr.ReadToEnd();
            }
            catch (Exception e)
            {
                result = "Could not fetch changelog at this time. Try again soon.";
            }

            result = result.Replace("~", System.Environment.NewLine);
            txtChanges.Text = result;
        }
    }
}
